package kt.hkit.androidcomplete01.chapter07;

import kr.hkit.androidcomplete01.R;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Bundle;
import android.view.View;

public class DrawBitmapEx extends Activity {
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(new MyBitmap(this));
	}
	
	class MyBitmap extends View{
		Bitmap bit;
		
		public MyBitmap(Context context) {
			super(context);
			bit = BitmapFactory.decodeResource(getResources(), R.drawable.harubang);
		}

		protected void onDraw(Canvas canvas) {
			super.onDraw(canvas);
			canvas.drawBitmap(bit, 10, 10, null);
			canvas.drawBitmap(bit, null, new Rect(120, 10, 170, 85), null);
			canvas.drawBitmap(bit, new Rect(30, 30, 70, 80), new Rect(180, 10, 180+80, 10+100), null);
		}

		
	}
}
